package com.fire.social.controller;

import com.fire.social.config.Result;
import com.fire.social.config.Results;
import com.fire.social.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LikeController {

    @Autowired
    private LikeService likeService;

    @PostMapping("/user/like")
    @ResponseBody
    public Result likeHobby(@RequestParam("account") String account,
                            @RequestParam("hobbyid") Long hobbyid) {
        Integer num = likeService.likeHobby(account, hobbyid);
        return Results.success();
    }

    @PostMapping("/user/unlike")
    @ResponseBody
    public Result unlikeHobby(@RequestParam("account") String account,
                              @RequestParam("hobbyid") Long hobbyid) {
        Integer num = likeService.unlikeHobby(account, hobbyid);
        return Results.success();
    }

}
